/*
#include <iostream>

using namespace std;


void func(int a)
{
    if (a == 0)
    {
        throw "a不能为0噢";
    }
    else 
    {
        cout << a << endl;
    }
}
*/

/*
int main()
{
    try 
    {
        int a = 0;
        cin >> a;
        func(a);
    }
    catch(const char* s)
    {
        cout << s << endl;
    }
    catch(...) 
    {
        cout << "未知错误" << endl;
    }

    return 0;
}
*/




#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

void func()
{
	size_t tmp = rand() % 3;
	if (tmp == 2)
	{
		throw 99999999;
	}
	else if (tmp == 1)
	{
		throw string("我不是零也不是二");
	}
	else
	{
		throw "我是零";
	}
}

int main()
{
	while (1)
	{
		Sleep(2000);
		try
		{
			func();
		}
		catch (const string& s)
		{
			cout << s << endl;
		}
		catch (const int a)
		{
			cout << a << endl;
		}
		catch (...)
		{
			cout << "未知错误" << endl;
		}
	}

	return 0;
}

